/*
 * @Author: HeAo
 * @Date: 2021-09-28 11:35:07
 * @LastEditTime: 2021-09-28 11:49:21
 * @LastEditors: HeAo
 * @Description:
 * @FilePath: \web2103-2105\web2103code\3-1-ES6\day04\7-消除魔术字符串.js
 * 别乱动！
 */
let shapes = {
  SJX: Symbol('三角形'),
  JX: Symbol('矩形'),
  YX: Symbol('圆形')
}

function computedArea (shape, options) {
  let result = 0
  switch (shape) {
    case shapes.SJX:
      result = .5 * options.width * options.height
      break;
    case shapes.JX:
      result = options.width * options.height
      break;
    case shapes.YX:
      result = Math.PI * options.r * options.r
      break;
    default:
      result = -1
      break;
  }
  return result
}

let result = computedArea(shapes.SJX, { width: 10, height: 20 })
console.log(result);
